package FuncHello

import (
	"github.com/gin-gonic/gin"
)

func Hello1(context *gin.Context) {
	//通过context的param进行获取
	id := context.Param("id")
	context.HTML(200, "demo01/hello.html", id)
}

func Hello2(context *gin.Context) {
	//通过context的param进行获取
	id := context.Param("id")
	context.HTML(200, "demo01/hello.html", id)
}

func Hello3(context *gin.Context) {
	//通过context的param进行获取
	id := context.Query("id")
	name := context.Query("name")
	var m map[string]string = make(map[string]string, 2)
	m["id"] = id
	m["name"] = name
	context.HTML(200, "demo01/hello.html", m)
}

func Hello4(context *gin.Context) {
	//通过context的DefaultQuer给与默认值
	id := context.DefaultQuery("id", "1001")
	name := context.DefaultQuery("name", "张三")
	var m map[string]string = make(map[string]string, 2)
	m["id"] = id
	m["name"] = name
	context.HTML(200, "demo01/hello.html", m)
}

func Hello5(context *gin.Context) {
	//通过context获取多个值---数组
	arr := context.QueryArray("id")
	context.HTML(200, "demo01/hello.html", arr)
}

func Hello6(context *gin.Context) {
	//通过context获取多个值---map
	m := context.QueryMap("user")
	context.HTML(200, "demo01/hello.html", m)
}
